package cn.ljlao.common.exception;



/**
 * @Author: liuzhen
 * @Created: 2020-01-09 15:41
 * @Description: 自定义业务异常类
 */
public class BusinessException extends RuntimeException {
    /**
     * 异常 code
     */
    private final int exceptionCode;

    /**
     * 异常提示
     */
    public final String defaultMessage;

    public BusinessException(int exceptionCode, String defaultMessage) {
        super(defaultMessage);
        this.exceptionCode = exceptionCode;
        this.defaultMessage = defaultMessage;
    }

    public BusinessException(MallResponseCode cgoResponseCode) {
        this(cgoResponseCode.getRspCode(), cgoResponseCode.getMsg());
    }

    public int getExceptionCode() {
        return exceptionCode;
    }

    public String getDefaultMessage() {
        return defaultMessage;
    }
}
